package cn.mesmile.jni;


import cn.hutool.core.convert.Convert;

import java.util.List;

/**
 * @author zb
 * @date 2021/2/25 10:21
 * @Description
 */
public class ObjectDemo {

    {
        System.load("D:\\IdeaProjects\\xdclass-cloud\\xdclass-native\\src\\main\\java\\cn\\mesmile\\jni\\Project2.dll");
    }

    /** 做加法 */
    public native int add(int a ,int b);

    /** 做字符串的拼接 */
    public native String addString(String str);

    /** 让数组中的每个数字都加 10 */
    public native int[] getArray(int[] array);

    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5, 6};
        ObjectDemo objectDemo = new ObjectDemo();
        System.out.println("objectDemo.add(10, 20) = " + objectDemo.add(10, 20));
        System.out.println("objectDemo.addString(\"hello\") = " + objectDemo.addString("hello"));
        int[] array2 = objectDemo.getArray(array);
        List<Integer> integers = Convert.toList(Integer.class, array2);
        System.out.println("integers = " + integers);
    }

}
